package com.hechang.controller;

import com.hechang.util.HttpUtils;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class IndexController {
    
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public void init(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
        String basePath = HttpUtils.getBasePath(request);
        try {
            response.sendRedirect(basePath + "/hechang/house_source/list.htm");
        } catch (IOException ex) {
            Logger.getLogger(IndexController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    @RequestMapping(value = "/index.htm", method = RequestMethod.GET)
    public void index(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
        String basePath = HttpUtils.getBasePath(request);
        try {
            response.sendRedirect(basePath + "/hechang/house_source/list.htm");
        } catch (IOException ex) {
            Logger.getLogger(IndexController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
